Fix dotted canvas dashboard filenames#9626
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates entity-name inference for file paths so that Rill resource filenames with dots (e.g. dashboard.canvas.yaml) preserve the dotted portion when deriving the resource name, while keeping legacy behavior for non-resource data files with compound extensions.
Changes:
- Update
getNameFromFileto strip only the final resource extension for.yaml,.yml, and.sqlfiles (preserving dots in the base name). - Retain legacy compound-extension stripping for non-resource data files.
- Add regression tests covering dotted YAML/YML/SQL resource filenames.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| web-common/src/features/entity-management/entity-mappers.ts | Adjusts name derivation to preserve dotted resource basenames by stripping only the final resource extension. |
| web-common/src/features/entity-management/entity-mappers.spec.ts | Adds regression tests validating dotted resource filename handling for YAML/YML/SQL. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // Rill resource names are inferred by removing only the final resource file | ||
| // extension, so dotted names like `dashboard.canvas.yaml` stay intact. | ||
| for (const extension of [".yaml", ".yml", ".sql"]) { | ||
| if (basename.endsWith(extension)) { | ||
| return basename.slice(0, -extension.length); | ||
| } | ||
| } |
There was a problem hiding this comment.
Addressed in bbaa274. I centralized the resource extension list in file-path-utils and made extractFileExtension resource-aware, so dotted resource files return .yaml/.yml/.sql while non-resource data files keep the existing compound-extension behavior. Added regression coverage for dotted resource extension extraction and kind inference.
Summary
Test